home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-02-20 | 7.3 KB | 166 lines | [TEXT/CWIE] |
-
- #include "AbstractProperty.h"
- #include "Exceptions.h"
-
- #include <AppleEvents.h>
- #include <AERegistry.h>
- #include <ASRegistry.h>
-
- //========================================================================================
- // CLASS TAbstractProperty
- //========================================================================================
-
- #pragma segment ObjectResident
- ImplementSmallClassData(TAbstractProperty, clProperty);
-
- #pragma segment Foundation
-
- //----------------------------------------------------------------------------------------
- // TAbstractProperty::~TAbstractProperty:
- //----------------------------------------------------------------------------------------
- TAbstractProperty::~TAbstractProperty()
- {
- } // TAbstractProperty::~TAbstractProperty
-
- //----------------------------------------------------------------------------------------
- // TAbstractProperty::IAbstractProperty:
- //----------------------------------------------------------------------------------------
- void TAbstractProperty::IAbstractProperty(TAbstractScriptableObject* objectOfDesignation, DescType propertyIdentifier)
- {
- fPropertyIdentifier = propertyIdentifier;
-
- TAbstractDesignator::IAbstractDesignator(objectOfDesignation);
- } // TAbstractProperty::IAbstractPropert
-
- //----------------------------------------------------------------------------------------
- // TAbstractProperty::ObjectClass:
- //
- // The object class of properties is always the default type of said property
- //----------------------------------------------------------------------------------------
- DescType TAbstractProperty::ObjectClass(const TAETransaction& t, Boolean recordedClass /*= false*/)
- {
- if(recordedClass)
- return cProperty;
- else
- return this->DefaultType(t, pContents);
- } // TAbstractProperty::ObjectClass
-
- //----------------------------------------------------------------------------------------
- // TAbstractProperty::DerivedFromOSLClass:
- //----------------------------------------------------------------------------------------
- Boolean TAbstractProperty::DerivedFromOSLClass(const TAETransaction& t, DescType objectClass)
- {
- return ((objectClass == cProperty) || (TAbstractDesignator::DerivedFromOSLClass(t, objectClass)));
- } // TAbstractProperty::DerivedFromOSLClass
-
- //----------------------------------------------------------------------------------------
- // TAbstractProperty::PropertyIdentifier:
- //----------------------------------------------------------------------------------------
- DescType TAbstractProperty::PropertyIdentifier()
- {
- return fPropertyIdentifier;
- } // TAbstractProperty::PropertyIdentifier
-
- //----------------------------------------------------------------------------------------
- // TAbstractProperty::MakeKeyDataForSelf:
- //----------------------------------------------------------------------------------------
- void TAbstractProperty::MakeKeyDataForSelf(const TAETransaction&, DescType& keyForm, TDescriptor& keyData)
- {
- keyForm = formPropertyID;
- keyData.SetDescTypeData(this->PropertyIdentifier());
- } // TAbstractProperty::MakeKeyDataForSelf
-
- //----------------------------------------------------------------------------------------
- // TAbstractProperty::ElementIterator:
- //----------------------------------------------------------------------------------------
- TAbstractObjectIterator* TAbstractProperty::ElementIterator(const TAETransaction&)
- {
- FailErr(errAENoSuchObject);
- return nil;
- } // TAbstractProperty::ElementIterator
-
-
- //========================================================================================
- // CLASS TGenericProperty
- //========================================================================================
-
- #pragma segment ObjectResident
- ImplementSmallClassData(TGenericProperty, clGenericProperty);
-
- #pragma segment Foundation
-
- //----------------------------------------------------------------------------------------
- // TGenericProperty::~TGenericProperty:
- //----------------------------------------------------------------------------------------
- TGenericProperty::~TGenericProperty()
- {
- } // TGenericProperty::~TGenericProperty
-
- //----------------------------------------------------------------------------------------
- // TGenericProperty::IGenericProperty:
- //----------------------------------------------------------------------------------------
- void TGenericProperty::IGenericProperty(TAbstractScriptableObject* objectOfDesignation, const TPropertyDataDescription& propertyDescription)
- {
- fAdditionalInfo = propertyDescription.AdditionalInfo();
-
- TAbstractProperty::IAbstractProperty(objectOfDesignation, propertyDescription.PropertyIdentifier());
- } // TGenericProperty::IGenericProperty
-
- //----------------------------------------------------------------------------------------
- // TGenericProperty::BestType:
- //----------------------------------------------------------------------------------------
- DescType TGenericProperty::BestType(const TAETransaction& t, DescType propertyName)
- {
- if(propertyName == pContents)
- return ObjectOfDesignation()->BestType(t, PropertyIdentifier());
- else
- return Inherited::BestType(t, propertyName);
- } // TGenericProperty::BestType
-
- //----------------------------------------------------------------------------------------
- // TGenericProperty::DefaultType:
- //----------------------------------------------------------------------------------------
- DescType TGenericProperty::DefaultType(const TAETransaction& t, DescType propertyName)
- {
- if(propertyName == pContents)
- return ObjectOfDesignation()->DefaultType(t, PropertyIdentifier());
- else
- return Inherited::DefaultType(t, propertyName);
- } // TGenericProperty::DefaultType
-
- //----------------------------------------------------------------------------------------
- // TGenericProperty::CanReturnDataOfType:
- //----------------------------------------------------------------------------------------
- Boolean TGenericProperty::CanReturnDataOfType(const TAETransaction& t, DescType propertyName, DescType desiredType)
- {
- if(propertyName != pContents)
- return Inherited::CanReturnDataOfType(t, propertyName, desiredType);
- if(desiredType == 0)
- return false;
-
- return ObjectOfDesignation()->CanReturnDataOfType(t, PropertyIdentifier(), desiredType);
- } // TGenericProperty::CanReturnDataOfType
-
- //----------------------------------------------------------------------------------------
- // TGenericProperty::GetProperty:
- //----------------------------------------------------------------------------------------
- TDescriptor TGenericProperty::GetProperty(const TAETransaction& t, DescType propertyName, DescType requestedType, unsigned long additionalInfo)
- {
- if(propertyName == pContents)
- return ObjectOfDesignation()->GetProperty(t, PropertyIdentifier(), requestedType, fAdditionalInfo);
- else
- return Inherited::GetProperty(t, propertyName, requestedType, additionalInfo);
- } // TGenericProperty::GetProperty
-
- //----------------------------------------------------------------------------------------
- // TGenericProperty::SetProperty:
- //----------------------------------------------------------------------------------------
- void TGenericProperty::SetProperty(const TAETransaction& t, DescType propertyName, TDescriptor& keyData, unsigned long additionalInfo)
- {
- if(propertyName == pContents)
- ObjectOfDesignation()->SetProperty(t, PropertyIdentifier(), keyData, fAdditionalInfo);
- else
- Inherited::SetProperty(t, propertyName, keyData, additionalInfo);
- } // TGenericProperty::SetProperty
-
-